package com.gxxy.spring.kp04_integration.cls01_jdbc;

import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class JDBCTest {

	@Autowired
	private IStudentDao stuDao;

	@Test
	public void testJDBCSave() throws Exception {
		stuDao.save(new Student("Jerry", 183456D));
	}

	@Test
	public void testJDBCDelete() throws Exception {
		stuDao.delete(new Student(97L));
	}

	@Test
	public void testJDBCUpdate() throws Exception {
		Student student = stuDao.get(new Student(96L));
		System.out.println("GET:" + student);
		/*student.setName("Herry");
		stuDao.update(student);*/
	}

	@Test
	public void testJDBCList() throws Exception {
		List<Student> stus = stuDao.list();
		System.out.println(stus);
	}

}
